function [a] = Function_DMRS_a_slots(Mode, n_ID, NCS, SeqGroup, NCellID, NLayers)
	% a_slots Generate the cyclic shift values (a) for 20 slots
	% Outputs:     a                        - NLayers x 20 matrix of n_PN values  (one for each slot)
	%                                         each row corresponds to layers 0,1,2,3, respectively
	% Spec:        3GPP TS 36.211 section 5.5.2.1.1 v13.0.0
    
    switch Mode
        case 'psbch_D2D'
            n_CS_slots_layer = mod(floor(n_ID/2),8);
            a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'psbch_V2X'
            n_CS_slots_layer = mod(floor(n_ID/2),8);
        	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'psdch'
            n_CS_slots_layer = 0;
           	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'pssch_D2D'
            n_CS_slots_layer = mod(floor(n_ID/2),8);
          	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'pssch_V2X'
            n_CS_slots_layer = mod(floor(n_ID/2),8);
        	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'pscch_D2D'
            n_CS_slots_layer = 0;
        	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'pscch_V2X'
            n_CS_slots_layer = NCS;
        	a = [1, 1] * 2 * pi * n_CS_slots_layer / 12;
        case 'pusch'
            D_ss = SeqGroup;
            if(n_ID>0)
                D_ss = 0;  % is virtual cell ID, override given D_ss
            else
                n_ID = NCellID;
            end
                
            
%           n_DMRS_2_layers = h.n_DMRS_2();     % Updata later
%         	n_DMRS_1 = h.n_DMRS_1();            % Updata later
%          	n_PN = h.n_PN(n_ID, D_ss);      	% Updata later
                
            n_CS_slots_layer = zeros(NLayers, 2);
          	for l = 1:NLayers
             	n_CS_slots_layer(l,:) = mod(n_DMRS_1 + n_DMRS_2_layers(l) + n_PN, 12);
            end
                
            a = 2 * pi * n_CS_slots_layer / 12;
    end
end